package com.umeng.analytics.pro;

import android.content.Context;
import android.content.SharedPreferences;

public class be implements av {
    public int a;
    public int b;
    public long c;
    private final int d;
    private int e;
    private long f;
    private long g;
    private static final String h = "successful_request";
    private static final String i = "failed_requests ";
    private static final String j = "last_request_spent_ms";
    private static final String k = "last_request_time";
    private static final String l = "first_activate_time";
    private static final String m = "last_req";
    private Context n;

    public be(Context arg5) {

        this.d = 3600000;
        this.f = 0;
        this.g = 0;
        this.a(arg5);
    }

    private void a(Context arg7) {
        this.n = arg7.getApplicationContext();
        SharedPreferences v0 = ba.a(arg7);
        this.a = v0.getInt("successful_request", 0);
        this.b = v0.getInt("failed_requests ", 0);
        this.e = v0.getInt("last_request_spent_ms", 0);
        this.c = v0.getLong("last_request_time", 0);
        this.f = v0.getLong("last_req", 0);
    }

    public void a() {
        this.i();
    }

    public void b() {
        this.j();
    }

    public void c() {
        this.g();
    }

    public void d() {
        this.h();
    }

    public int e() {
        int v0 = 3600000;
        if(this.e <= v0) {
            v0 = this.e;
        }

        return v0;
    }

    public boolean f() {
        boolean v1 = true;
        int v0 = this.c == 0 ? 1 : 0;
        int v3 = !cc.a(this.n).h() ? 1 : 0;
        if(v0 == 0 || v3 == 0) {
            v1 = false;
        }

        return v1;
    }

    public void g() {
        ++this.a;
        this.c = this.f;
    }

    public void h() {
        ++this.b;
    }

    public void i() {
        this.f = System.currentTimeMillis();
    }

    public void j() {
        this.e = ((int)(System.currentTimeMillis() - this.f));
    }

    public void k() {
        ba.a(this.n).edit().putInt("successful_request", this.a).putInt("failed_requests ", this.b).putInt("last_request_spent_ms", this.e).putLong("last_request_time", this.c).putLong("last_req", this.f).commit();
    }

    public long l() {
        SharedPreferences v0 = ba.a(this.n);
        this.g = ba.a(this.n).getLong("first_activate_time", 0);
        if(this.g == 0) {
            this.g = System.currentTimeMillis();
            v0.edit().putLong("first_activate_time", this.g).commit();
        }

        return this.g;
    }

    public long m() {
        return this.f;
    }
}

